def m_sort(array, left, right):
    if left >= right:
        return
    mid=(left+right)//2
    m_sort(array, left, mid)
    m_sort(array, mid + 1, right)
    i,j=left,mid+1
    result=[]
    while i <= mid and j <= right:
        if array[i] <= array[j]:
            result.append(array[i])
            i+=1
        else:
            result.append(array[j])
            j+=1
    while i <= mid:
        result.append(array[i])
        i+=1
    while j <= right:
        result.append(array[j])
        j+=1
    array[left:right+1]=result

def merge_sort(array):
    m_sort(array,0,len(array)-1)

array=[7,5,2,4,1,6,3,0]
print(array)
merge_sort(array)
print(array)
